package main

import (
	"log"
	"net/http"
	"os"
)

func HelloServer(w http.ResponseWriter, req *http.Request) {
	w.Header().Set("Content-Type", "text/plain")
	w.Write([]byte("This is an example using https in golang. ---- v1 \n"))
}
// todo https://localhost/hello
func main() {
	http.HandleFunc("/", HelloServer)
	current,_:=os.Getwd()
	err := http.ListenAndServeTLS(":443", current+"/certs/server.pem", current+"/certs/server-key.pem", nil)
	if err != nil {
		log.Fatal("ListenAndServe: ", err)
	}
}